import Food from './Food';
import ScorePanel from './ScorePanel';
import Snake from './Snake';

// 游戏对象
class GameControl {
    snake: Snake;
    food: Food;
    scorePanel: ScorePanel;

    constructor() {
        this.snake = new Snake();
        this.food = new Food();
        this.scorePanel = new ScorePanel();
        this.init();
    }

    init(){
        //绑定键盘按键事件
        document.addEventListener('keydown',this.keydownHandler)
    }
    keydownHandler(event:KeyboardEvent){
        console.log(event.key)
    }
}

export default GameControl;